<?php
 header("Content-Type:text/html;charset=utf-8");//防止网页中文乱码
 require 'dbcon.php';

 $usname=$_REQUEST['usname'];//获取用户呢称
 $message=$_REQUEST['message'];// 获取用户留言
 $note=$_REQUEST['note'];
 date_default_timezone_set('Asia/Shanghai');//设置时区
 $date=date("Y-m-d h:i:s");  //获取当前的日期时间
 $sql="insert into tb_note(usname,message,note,date) values('{$usname}', '{$message}','{$note}','{$date}')";//写SQL语句
 $rs=$db->query($sql);//执行SQL语句
 if  ($rs==true)
 {
    echo "<script language='javascript' type='text/javascript'>"; 
    //echo "alert('发布成功！');";
    echo "window.location.href='index.php';";
    echo "</script>";
 }
 else {
    echo "<script language='javascript' type='text/javascript'>"; 
    echo "alert('发布失败！');";
    echo "window.location.href='index.php';";
    echo "</script>";
}
$db->close();
